{include file="public/head"}

<body>
<div id="wrapper">
    {include file="public/menu"}
    <div id="page-wrapper" class="gray-bg dashbard-1">
        {include file="public/nav"}
        <div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-10">
                <h2>资金出金</h2>
                <ol class="breadcrumb">
                    <li>
                        <a href="{:url('User/Panel')}">主页</a>
                    </li>
                    <li>
                        <strong>资金出金</strong>
                    </li>
                </ol>
            </div>
            <div class="col-lg-2">

            </div>
        </div>
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>资金出金</h5>
                        </div>

                        <div class="ibox-content">
                            <form class="form-horizontal m-t" id="commentForm">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">会员账号：</label>
                                    <div class="col-sm-8">
                                        <input id="username" name="username" maxlength="50" type="text" class="form-control" required="" aria-required="true" value="" onkeyup="this.value=this.value.replace(/[^\w]/g,'')">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">会员昵称：</label>
                                    <div class="col-sm-8">
                                        <input id="name" name="name" maxlength="50" type="text" class="form-control" required="" aria-required="true" onkeyup="this.value=this.value.replace(/^ +| +$/g,'')">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">会员手机：</label>
                                    <div class="col-sm-8">
                                        <input id="phone" name="phone" maxlength="11" type="text" class="form-control" required="" aria-required="true" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" >
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">登录密码：</label>
                                    <div class="col-sm-8">
                                        <input id="pass_login" name="pass_login" minlength="6" placeholder="6位密码" type="text" class="form-control" required="" aria-required="true">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">支付密码：</label>
                                    <div class="col-sm-8">
                                        <input id="pass_pay" name="pass_pay" minlength="6" placeholder="6位密码" type="text" class="form-control" required="" aria-required="true">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">邀请码：</label>
                                    <div class="col-sm-8">
                                        <input id="recommend" name="recommend" value="{$user.recommend_num}" type="text" class="form-control" required="" aria-required="true" >
                                    </div>
                                </div>


                                <div class="form-group">
                                    <div class="col-sm-4 col-sm-offset-3">
                                        <button class="btn btn-primary" type="submit">确认添加</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>

            </div>
        </div>
        {include file="public/foot"}

    </div>
</div>
</div>
{include file="public/footer"}
</body>
<script>
    $("form").submit(function (e) {
        e.preventDefault();
        var that = $(this)
        that.attr('disabled',true).css('pointer-events','none')
        $.ajax({
            type: "post",
            url: "{:url('User/UserAdd')}",
            data: $("form").serialize(),
            dataType: "json",
            beforeSend:function(){
                loadingIndex = layer.load(2, { //icon支持传入0-2
                    shade: [0.5, 'gray'], //0.5透明度的灰色背景
                    content: '加载中...',
                    success: function (layero) {
                        layero.find('.layui-layer-content').css({
                            'padding-top': '39px',
                            'width': '60px'
                        });
                    }
                });
            },
            success: function (data) {
                layer.close(loadingIndex)
                if(data.status == 1){
                    layer.msg(data.message,{time:1500},function () {
                        window.location.href = '{:url("User/Panel")}'
                    });

                }else{
                    layer.msg(data.message);
                    that.attr('disabled',false).css('pointer-events','auto')
                }
            }
        });
    })
</script>
</html>
